<%@ page import="top.sjydzq.www.bean.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>商品详情 - 狗东电商 GD.COM</title>
    <link href="../css/before/daohang.css" rel="stylesheet" type="text/css" />
    <link href="../css/before/common.css" rel="stylesheet" type="text/css" />
    <link href="../css/before/style.css" rel="stylesheet" type="text/css" />
    <style>
        #cartBtn {
            width: 100px;
            height: 30px;
            margin-left: 15px;
            background: #bb1700;
            border: none;
            color: #fff;
            border-radius: 5px;
        }
        #star {
            display: block;
            cursor: pointer;
            width: 100px;
            height: 30px;
            background: #ff8b01;
            text-align: center;
            border-radius: 5px;
            text-decoration: none;
            color: #fff;
            font-size: 14px;
            line-height: 30px;
        }
        .bottom10 {
            display: flex;
        }
    </style>
    <script>
        function star(productId, userId) {
          window.open (
            "/star?pid=" + productId + "&uid=" + userId,
            '关注结果', 'height=400, width=400, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no'
          );
        }
    </script>
</head>
<%
    User user = (User) session.getAttribute("user");

    int uid;
    if (user != null) {
        uid = user.getId();
    } else {
        uid = 0;
    }
%>
<body>
<iframe src="/head" frameborder="0" width="100%"> </iframe>
<div class="blank"></div>
	<div class="block clearfix">
		<div class="location ared">
			当前位置：<a href="/">首页</a> > 商品详情
		</div>
		<div class="blank"></div>
		<div id="goodsInfo">
			<div class="imgInfo">
				<input type="hidden" name="id" value="1" />
				<img src="<c:out value="${product.gpicture}" />"	width="230px" height="230px" />
			</div>
		</div>
		<!--商品表述-->
        <form action="/cart/add">
            <input type="text" hidden="hidden" name="pid" value="<c:out value="${product.id}" />">
            <input type="text" hidden="hidden" name="uid" value="<%= uid %>">
            <div class="goods_desc">
                <div class="bt">
                    <c:out value="${product.gname}" />
                </div>
                <div class="goods_show ared">
                    <ul>
                        <li>
                            <span>价格:</span> <strong class="yj">￥ <c:out value="${product.goprice}" /></strong>
                        </li>
                        <li>
                            <span>折扣价:</span><strong class="xj">￥ <c:out value="${product.grprice}" /></strong>
                        </li>
                        <li><span>类型:</span><a href="/product/list?type=category&tid=${product.goodstype_id}"><c:out value="${category}" /></a></li>
                        <li>
                            <span>购买数量:</span>
                            <input type="text" name="amount" class="good_txt" value="1" />
                            (库存<c:out value="${product.gstore}" />件)
                        </li>
                    </ul>
                </div>
                <p class="bottom10 top5 a_blue">
                    <a id="star" style="cursor: pointer">关注</a>
                    <input id="cartBtn" type="submit" value="添加到购物车" />
                </p>
            </div>
        </form>
		<!--end-->
	</div>
</body>
<script>
	document.querySelector("#star").onclick = function () {
        star(<c:out value="${product.id}" />, <%= uid %>);
	};
</script>
</html>
